<?php
require_once 'D:/collect_new/collect/classes/PHPExcel.php';
require_once 'D:/collect_new/collect/classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
// 设置载入含有贴图的bai sheet
//参数:
$path="C:\\Users\\yzs10\\Desktop\\abc.xlsx";

$objReader->setLoadSheetsOnly(array('Sheet1'));
$objPHPExcel = $objReader->load($path);
$drawing = new PHPExcel_Writer_Excel2007_Drawing();
$drawingHashTable = new PHPExcel_HashTable();
$drawingHashTable->addFromSource($drawing->allDrawings($objPHPExcel));
for ($i = 0; $i < $drawingHashTable->count(); ++$i)
{
	$memoryDrawing = $drawingHashTable->getByIndex($i);
	if ($memoryDrawing instanceof PHPExcel_Worksheet_MemoryDrawing)
	{
		$filename = '"C:\\Users\\yzs10\\Desktop\\images\\' . $memoryDrawing->getCoordinates() . '_' . $memoryDrawing->getHashCode() . '.jpg';
		// 将图片存到指定的du目录
		imagejpeg($memoryDrawing->getImageResource(), $filename);
		// 获得该图片所在的单元格
		$cell = $memoryDrawing->getWorksheet()->getCell($memoryDrawing->getCoordinates());
		// 将该zhi单元格的值设置为单元格的文本加dao上图片的 img 标签
		$cell->setValue($cell->getValue() . '<img src="' . $filename . '" />');
	}
}
print_r($cell);